package
{
	import capricornus.components.button.Button;
	import capricornus.components.button.CheckBox;
	import capricornus.components.button.LabelButton;
	import capricornus.components.button.RadioButton;
	import capricornus.components.button.TriggerButton;
	import capricornus.components.singleselectgroup.SingleSelectGroup;
	
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	
	public class ButtonTest extends Sprite
	{
		private var _group:SingleSelectGroup;
		private var _group2:SingleSelectGroup;
		
		private var _labelBtn:LabelButton;
		
		public function ButtonTest()
		{
			super();
			init();
		}
		
		private function init():void
		{
			_labelBtn = new LabelButton();
			_labelBtn.text = "LabelButton";
			_labelBtn.setColor( 0xff0000, 0x00ff00, 0x0000ff );
			_labelBtn.x = 100;
			_labelBtn.y = 10;
			addChild( _labelBtn );
			
			var lb:LabelButton = new LabelButton();
			lb.text = "LabelButton";
			lb.underline = true;
			lb.setGlowButton( 0xff0000 );
			lb.x = 180;
			lb.y = 10;
			addChild( lb );
			
			var b:Button = new Button();
			b.label = "测试";
			b.setLocation( 10, 10 );
			b.addEventListener( MouseEvent.CLICK, onClick );
			addChild( b );
			
			var s:Sprite = new Sprite();
			_group = new SingleSelectGroup();
			for( var i:int=0; i<3; i++ )
			{
				var tb:TriggerButton = new TriggerButton();
				tb.x = s.width + 2;
				tb.label = i.toString();
				s.addChild( tb );
				_group.addItem( tb );
			}
			addChild( s );
			s.x = 50;
			s.y = 50;
			
			s = new Sprite();
			var cb:CheckBox = new CheckBox();
			cb.label = "斯蒂芬";
			s.addChild( cb );
			s.x = 50;
			s.y = 100;
			addChild( s );
			
			var rb:RadioButton = new RadioButton();
			rb.label = "松岛枫";
			addChild( rb );
			rb.setLocation( 50, 150 );
			
			s = new Sprite();
			_group2 = new SingleSelectGroup();
			for( i=0; i<4; i++ )
			{
				rb = new RadioButton();
				rb.x = s.width + 4;
				s.addChild( rb );
				rb.group = _group2;
			}
			addChild( s );
			s.x = 50;
			s.y = 200;
		}
		
		private function onClick( e:MouseEvent ):void
		{
			trace( "click b " );
		}
	}
}